//
//  UIFactory.swift
//  3月5的项目
//
//  Created by 哦哦 on 16/3/12.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit
//抽象类
//所有的UI控件 都是通过这个类来进行实例化
//NSNumber 类 就是 使用抽象工厂设计模式来实现
class UIFactory {
    
    //抽象方法
    class func labelFactory(text: String,textColor: UIColor, fontSize: CGFloat,alignment: NSTextAlignment = .Center) -> UILabel {
        let l = UILabel.labelWith(text, textColor: textColor, fontSize: fontSize,alignment: alignment)
        return l
    }
    
    
    // 背景图片 + 图片的按钮的显示样式
    class func buttonWithImage(imageName: String, backImageName: String) -> UIButton {
        let btn = UIButton.buttonWithImage(imageName, backImageName: backImageName)
        return btn
        
    }
    
    
//    //背景图片 + 文字 + 图片样式的按钮
//    class func buttonWithtitle(title: String ,backImageName: String ,textColor: UIColor,fontSize: CGFloat,imageName: String? = nil) -> UIButton {
//        let btn = UIButton.buttonWithtitle(title, backImageName: backImageName, textColor: textColor, fontSize: fontSize,imageName: imageName)
//        return btn
//    }
//    //背景图片? + 文字  + 图片样式的按钮
    class func buttonWithtitle(title: String ,backImageName: String? ,textColor: UIColor,fontSize: CGFloat,imageName: String? = nil) -> UIButton {
        let btn = UIButton.buttonWithtitle(title, backImageName: backImageName, textColor: textColor, fontSize: fontSize,imageName: imageName)
        return btn
    }
}
